package com.bwie.auth.remote.factory;

import com.bwie.auth.remote.RemoteSystemService;
import com.bwie.common.constants.Constants;
import com.bwie.common.pojo.res.LoginRes;
import com.bwie.common.result.Result;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteSystemServiceFallbackFactory implements FallbackFactory<RemoteSystemService> {

    @Override
    public RemoteSystemService create(Throwable cause) {
        return new RemoteSystemService() {
            @Override
            public Result<LoginRes> getUserByUserName(String userName) {
                return Result.error(Constants.SERVICE_ERROR);
            }

            @Override
            public Result<LoginRes> getUserByPhone(String phone) {
                return Result.error(Constants.SERVICE_ERROR);
            }
        };
    }
}
